﻿/*                       NOTICE
 * 
 * This software was produced for the U. S. Government
 * under Contract No. FA8721-10-C-0001, and is
 * subject to the Rights in Noncommercial Computer Software
 * and Noncommercial Computer Software Documentation Clause
 * (DFARS) 252.227-7014 (JUN 1995)
 * 
 * Approved for Public Release: 11-2435
 * © 2011 The MITRE Corporation. All Rights Reserved. 
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GestureListenerClient.Services.Delegates
{
    public class GestureArgs : EventArgs
    {
        public Gestures.Gesture Gesture;
    }

    public class FiducialArgs : EventArgs
    {
        public Gestures.FiducialObject Fiducial;
    }

    public abstract class GestureCallbackDelegate
    {
        public delegate void OnGestureDelegate(object source, GestureArgs e);

        public event OnGestureDelegate OnGesture = delegate { };

        public abstract Dictionary<Type, OnGestureDelegate> eventMap { get; }
    }

    public abstract class FiducialCallbackDelegate
    {
        public delegate void OnFiducialDelegate(object source, FiducialArgs e);

        public event OnFiducialDelegate OnFiducial = delegate { };

        public abstract Dictionary<Type, OnFiducialDelegate> eventMap { get; }
    }

    public class DragGestureDelegate : GestureCallbackDelegate
    {
        public event OnGestureDelegate OnDragStart = delegate { };
        public event OnGestureDelegate OnDragChange = delegate { };
        public event OnGestureDelegate OnDragEnd = delegate { };

        public override Dictionary<Type, OnGestureDelegate> eventMap
        {
            get
            {
                return new Dictionary<Type, OnGestureDelegate>
                {
                    {typeof(Gestures.DragGestures.DragStart), OnDragStart},
                    {typeof(Gestures.DragGestures.DragChange), OnDragChange},
                    {typeof(Gestures.DragGestures.DragEnd), OnDragEnd}
                };
            }
        }
    }

    public class HoldGestureDelegate : GestureCallbackDelegate
    {
        public event OnGestureDelegate OnHoldGesture = delegate { };
        

        public override Dictionary<Type, OnGestureDelegate> eventMap
        {
            get
            {
                return new Dictionary<Type, OnGestureDelegate>
                {
                    {typeof(Gestures.TapGestures.Hold), OnHoldGesture}
                };
            }
        }
    }
    public class SlideGestureDelegate : GestureCallbackDelegate
    {
        public event OnGestureDelegate OnSlideStart = delegate { };
        public event OnGestureDelegate OnSlideChange = delegate { };
        public event OnGestureDelegate OnSlideEnd = delegate { };

        public override Dictionary<Type, OnGestureDelegate> eventMap
        {
            get
            {
                return new Dictionary<Type, OnGestureDelegate>
                {
                    {typeof(Gestures.SlideGestures.SlideStart), OnSlideStart},
                    {typeof(Gestures.SlideGestures.SlideChange), OnSlideChange},
                    {typeof(Gestures.SlideGestures.SlideEnd), OnSlideEnd}
                };
            }
        }

    }
    public class ZoomGestureDelegate : GestureCallbackDelegate
    {
        public event OnGestureDelegate OnZoomStart = delegate { };
        public event OnGestureDelegate OnZoomChange = delegate { };
        public event OnGestureDelegate OnZoomEnd = delegate { };

        public override Dictionary<Type, OnGestureDelegate> eventMap
        {
            get
            {
                return new Dictionary<Type, OnGestureDelegate>
                {
                    
                    {typeof(Gestures.ZoomGestures.ZoomStart), OnZoomStart},
                    {typeof(Gestures.ZoomGestures.ZoomChange), OnZoomChange},
                    {typeof(Gestures.ZoomGestures.ZoomEnd), OnZoomEnd}
                };
            }
        }
    }
    public class HoldSlideGestureDelegate : GestureCallbackDelegate
    {
        public event OnGestureDelegate OnHoldSlideStart = delegate { };
        public event OnGestureDelegate OnHoldSlideChange = delegate { };
        public event OnGestureDelegate OnHoldSlideEnd = delegate { };

        public override Dictionary<Type, OnGestureDelegate> eventMap
        {
            get
            {
                return new Dictionary<Type, OnGestureDelegate>
                {
                    {typeof(Gestures.HoldSlideGestures.HoldSlideStart), OnHoldSlideStart},
                    {typeof(Gestures.HoldSlideGestures.HoldSlideChange), OnHoldSlideChange},
                    {typeof(Gestures.HoldSlideGestures.HoldSlideEnd), OnHoldSlideEnd}
                };
            }
        }
    }
    public class TapGestureDelegate : GestureCallbackDelegate
    {
        public event OnGestureDelegate OnTap = delegate { };
        public event OnGestureDelegate OnDoubleTap = delegate { };
        
        public override Dictionary<Type, OnGestureDelegate> eventMap
        {
            get
            {
                return new Dictionary<Type, OnGestureDelegate>
                {
                    {typeof(Gestures.TapGestures.Tap), OnTap},
                    {typeof(Gestures.TapGestures.DoubleTap), OnDoubleTap},
                };
            }
        }
    }

    public class FiducialObjectDelegate : FiducialCallbackDelegate
    {

        public event OnFiducialDelegate OnObjectAdded = delegate { };
        public event OnFiducialDelegate OnObjectUpdated = delegate { };
        public event OnFiducialDelegate OnObjectRemoved = delegate { };

        public override Dictionary<Type, OnFiducialDelegate> eventMap
        {
            get
            {
                return new Dictionary<Type, OnFiducialDelegate>
                {
                    
                    {typeof(Gestures.FiducialObjects.FiducialObjectAdded), OnObjectAdded},
                    {typeof(Gestures.FiducialObjects.FiducialObjectRemoved), OnObjectRemoved},
                    {typeof(Gestures.FiducialObjects.FiducialObjectUpdated), OnObjectUpdated}
                };
            }
        }
    }
}
